﻿using BlazorAdmin.Models;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BlazorAdmin.Interface
{
    /// <summary>
    /// 通用权限管理服务
    /// </summary>
    public interface IBootstrapAdminService
    {
        /// <summary>
        /// 通过用户名获取角色列表
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns></returns>
        List<string> GetRoles(string userName);

        /// <summary>
        /// 通过用户获取授权应用列表
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns></returns>
        List<string> GetApps(string userName);
        /// <summary>
        /// 通过用户获取 Url 授权
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="url">请求地址</param>
        /// <returns></returns>
        Task<bool> AuhorizingNavigation(string userName, string url);

        /// <summary>
        /// 通过用户获取 Block 授权
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="url">请求地址</param>
        /// <param name="blockName">Block 名称</param>
        /// <returns></returns>
        bool AuhorizingBlock(string userName, string url, string blockName);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userName">登录名</param>
        /// <param name="password">登录密码</param>
        /// <param name="isRemember">是否记住密码</param>
        /// <param name="domain">登录的域</param>
        /// <returns></returns>
        (JwtUserData, User, string) Login(UserLogin param, bool isRemember, string domain = "");
    }
}
